
const adminMenuList: any[] = [
    {
        name: '系统查看',
        url: '/main/overview',
        type: 1,
        id: 38,
        icon: 'Aim',
        children: [
            {
                name: '测试列表',
                url: '/main/overView/overview',
                type: 1,
                id: 39,
                icon: 'Apple',
                children: [
                    {
                        name: '用户管理',
                        url: '/main/overView/view',
                        type: 2,
                        id: 49324232,
                        icon: 'AlarmClock',
                        hideMenu: false
                    },
                    {
                        name: 'ElementPlus文档',
                        url: '/main/test/test1',
                        type: 2,
                        id: 492,
                        icon: 'Apple',
                        hideMenu: false
                    },
                    {
                        name: '测试3',
                        url: '/test111',
                        type: 3,
                        id: 492222,
                        icon: 'Apple',
                        hideMenu: false
                    }
                ]
            },
            {
                name: '地图路线',
                url: '/main/overView/search',
                type: 2,
                id: 49,
                icon: 'Burger'
            },
            {
                name: '中国地图',
                url: '/main/overView/map',
                type: 2,
                id: 541,
                icon: 'Burger'
            }
        ]
    },
    {
        name: '系统管理',
        url: '/main/system',
        type: 1,
        id: 40,
        icon: 'Chicken',
        children: [
            {
                name: '数字滚动',
                url: '/main/system/user',
                type: 2,
                id: 11,
                icon: 'Chicken'
            },
            {
                name: '地图轨迹',
                url: '/main/system/department',
                type: 2,
                id: 12,
                icon: 'Cpu'
            },
            {
                name: 'echarts列表',
                url: '/main/system/role',
                type: 2,
                id: 13,
                icon: 'DataLine'
            },
            {
                name: '菜单管理',
                url: '/main/system/menu',
                type: 2,
                id: 14,
                icon: 'Apple'
            }
        ]
    },
    {
        name: '商品中心',
        url: '/main/product',
        type: 1,
        id: 15,
        icon: 'ElementPlus',
        children: [
            {
                name: '商品类别',
                url: '/main/product/category',
                type: 2,
                id: 16,
                icon: 'Food'
            },
            {
                name: '中心',
                url: '/main/product/center',
                type: 2,
                id: 189,
                icon: 'Fries'
            }
        ]
    },
]

const testMenuList: any[] = [
    {
        name: '系统查看',
        url: '/main/overView',
        type: 1,
        id: 38,
        icon: 'Aim',
        children: [
            {
                name: '核心技术',
                url: '/main/overView/overview',
                type: 1,
                id: 39,
                icon: 'Apple',
                children: [
                    {
                        name: '用户管理',
                        url: '/main/overView/view',
                        type: 2,
                        id: 492,
                        icon: 'AlarmClock',
                        hideMenu: false
                    },
                    {
                        name: 'ElementPlus文档',
                        url: '/main/test/test1',
                        type: 2,
                        id: 492,
                        icon: 'Apple',
                        hideMenu: false
                    }
                ]
            },
            {
                name: '地图路线',
                url: '/main/overView/search',
                type: 2,
                id: 49,
                icon: 'Burger'
            }
        ]
    },
    {
        name: '系统管理',
        url: '/main/system',
        type: 1,
        id: 38,
        icon: 'Chicken',
        children: [
            {
                name: '数字滚动',
                url: '/main/system/user',
                type: 2,
                id: 11,
                icon: 'Chicken'
            },
            {
                name: '地图轨迹',
                url: '/main/system/department',
                type: 2,
                id: 12,
                icon: 'Cpu'
            },
            {
                name: 'echarts列表',
                url: '/main/system/role',
                type: 2,
                id: 13,
                icon: 'DataLine'
            },
        ]
    },
]
function login(ctx: any) {
    const res = JSON.parse(ctx.body)
    const { username, password } = res
    if (username === 'admin' || username === 'test') {
        if (username === 'admin' && password === '12345') {
            return {
                code: 0,
                token: "xasdeasdasrrw",
                userInfo: { username: "超级管理员", id: 1 },
                permissions: ['create', 'add', 'delete', 'update', 'view', 'edit'],
                data: adminMenuList
            }
        } else if (username === 'test' && password === '12345') {
            return {
                code: 0,
                token: "xasdeasdasrrw",
                userInfo: { username: "普通用户", id: 2 },
                permissions: ['add', 'update', 'view'],
                data: testMenuList
            }
        }
        else {
            return {
                code: 400,
                message: "密码或者用户名错误"
            }
        }
    }
}

export default {
    login
}